#!/usr/bin/env python
# -- coding: utf-8 --
# author：马海晨
# time:2025/4/28
import os
import yaml


# 对yaml文件读写删除方法的封装
def read_yaml():
    with open("D:\\Mt_pytest\\extract.yaml", encoding='utf-8') as f:
        value = yaml.load(stream=f, Loader=yaml.FullLoader)
        return value

def write_yaml(data):
    with open("D:\\Mt_pytest\\extract.yaml", encoding='utf-8',mode='w') as f:
        yaml.dump(data, stream=f, allow_unicode=True)

def clear_yaml():
    with open("D:\\Mt_pytest\\extract.yaml", encoding='utf-8',mode='w') as f:
        f.truncate()


def read_caseyaml(filepath):
    with open(filepath, encoding='utf-8',mode='r') as f:
        value = yaml.load(stream=f, Loader=yaml.FullLoader)
        return value



if __name__ == '__main__':
    print(read_caseyaml('D:\Mt_pytest\\testcases\\test_login.yaml'))